home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12712 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: tank.news.pipex.net!pipex!warwick!leicester!usenet
  2. From: "J. Springthorpe" <juy@le.ac.uk>
  3. Newsgroups: comp.lang.c++
  4. Subject: FILES & cin.* help needed please...
  5. Date: 21 Mar 1996 08:02:11 GMT
  6. Organization: University of Leicester, UK
  7. Message-ID: <4ir2e3$r7i@falcon.le.ac.uk>
  8. NNTP-Posting-Host: hawk.le.ac.uk
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1S (X11; I; IRIX 5.3 IP19)
  13. X-URL: news:comp.lang.c++
  14.  
  15. help would be very much appreciated. My c++ source code works fine using
  16. borland c++ turbo.
  17.  
  18. the source code compiles fine using watcom c++, however, my program crashes out
  19. when it comes across this line (while running);
  20.  
  21. Member m; // class
  22. membersFile.open("members.dat", ios::in | ios::binary);
  23. membersFile.read((char *) &m, sizeof(m));    // DOES NOT LIKE THIS LINE
  24.  
  25.  
  26. when trying to compile source code on an sgi machine using CC, I get these
  27. complile errors;
  28.  
  29. members.cpp:
  30. "member.h", line 8: error(3337): invalid redeclaration of type name "Member"
  31.   class Member
  32.         ^
  33.  
  34. "members.cpp", line 30: error(3225): class "ios" has no member "binary"
  35.     membersFile.open("members.dat", ios::app | ios::binary); // ios::app -
  36. append mode
  37.  
  38. If any one is a die hard c++ whiz, I'd be happy to send you my source code
  39. (only a small program) for more details. Thanks v. much for any help.
  40.  
  41.  
  42.  
  43. 2) also, could some one give me some vibes on how cin.get, cin.ignore,
  44. cin.getline etc are suppose to work. I have probs trying to input a string
  45. (with white space) into a variable e.g. "something like";
  46.  
  47. cin.get(name, 80);
  48. cin.ignore(80, '\n');          // when ran, the program skips these lines...
  49.  
  50. cin.get(address, 90);         // is it possible to use [BUFSIZ]?
  51. cin.ignore(90, '\n');
  52.  
  53. *******************************************************************************
  54. *               Stunt Bat Juy - Most Dramatic Grade V Probe Run               *
  55. *                http://www.le.ac.uk/CWIS/SU/SO/CASOC/juy.html                *
  56. *******************************************************************************
  57.  
  58.